JBoss Community Archive (Read Only)

Teiid 8.3

Portfolio VDB

A VDB can be built with either the Designer tool or through a simple XML file called a Dynamic VDB. For this example we will use Dynamic VDB. If you would like to use the Designer to build your VDB, check out the Designer examples. If you need to build any view layers using your source, you must use the Designer based approach to building the VDB.

Portfolio VDB

This XML file defines a set of sources that can be accessed by the client application.  Below is the "portfolio-vdb.xml" example vdb (copy available at "dynamicvdb-datafederation/src/vdb/portfolio-vdb.xml")

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="Portfolio" version="1">

    <description>The Portfolio Dynamic VDB</description>

    <!--
      Setting to use connector supplied metadata. Can be "true" or "cached".
      "true" will obtain metadata once for every launch of Teiid.
      "cached" will save a file containing the metadata into
      the deploy/<vdb name>/<vdb version/META-INF directory
    -->
    <property name="UseConnectorMetadata" value="true" />


    <!--
      Each model represents a access to one or more sources.
      The name of the model will be used as a top level schema name
      for all of the metadata imported from the connector.

      NOTE: Multiple models, with different import settings, can be bound to
      the same connector binding and will be treated as the same source at
      runtime.
    -->
    <model name="MarketData">
        <!--
            Each source represents a translator and data source. There are
            pre-defined translators, or you can create one.
        -->
        <source name="text-connector" translator-name="file" connection-jndi-name="java:/marketdata-file"/>
    </model>

    <model name="Accounts">
        <!--
          JDBC Import settings

          importer.useFullSchemaName directs the importer to drop the source
          schema from the Teiid object name, so that the Teiid fully qualified name
          will be in the form of <model name>.<table name>
        -->
        <property name="importer.useFullSchemaName" value="false"/>

         <!--

            This connector is defined to reference the H2 localDS" 

          -->

        <source name="h2-connector" translator-name="h2" connection-jndi-name="java:/accounts-ds"/>

    </model>

</vdb>

The above vdb XML structure is explained.

  1. The "vdb" element defines the virtual database that has a name of "Portfolio" with version "1"

  2. A "model" element represents a schema that is being integrated. This sample defines two sources, "MarketData" that represents the schema for the text file that has the stock price information and "Accounts" that represents the "portfolio" schema in the HSQL database.

  3. The "source" element inside the "model" element defines the "name" of the source (can be any name), name of the translator (defines the type of the source like oracle, db2, mysql, h2, file, ws, etc..) and the "connection-jndi-name" defines the source's JNDI name in the JBoss AS container.

  4. Also note that inside the "model" elements, some "property" elements can be used to define how metadata should be imported from the source. For more information, check out the Reference Guide's Dynamic VDB section.

As part of the deployment steps in the quick start, the portfolio-vdb.xml will be deployed to the JBoss AS server.   Also note, the portfolio-vdb.xml.dodeploy (also referred to as a marker file, which is empty) is also deployed so that the Teiid Runtime is triggered to load the vdb.  The VDB's data sources will then be validated for availability, and if successful, the VDB status will be set to "Active". 

If the data sources are created correctly and VDB deployed correctly, then you will see an informational message in the JBoss AS 7.1.1 console that the VDB has been deployed and in "active" state. If there are any errors then you will see the VDB not deployed or in an "inactive" state. Find the issues on the console and fix them before you proceed any further.

If you see the VDB in the "active" state, then go to the next section to learn how to connect to the VDB.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 12:38:03 UTC, last content change 2013-03-14 16:27:36 UTC.